<template>
    <div>
        <button @click="show">显示/隐藏</button>
        <transition name="hello" appear>
            <h1 v-show="isShow">你好啊</h1>
        </transition>        
    </div>
</template>

<script>
export default {
    name:'TestComponent',
    data(){
        return {
            isShow: true
        };
    },
    methods:{
        show(){
            this.isShow = !this.isShow;
        }
    }
}
</script>

<style scoped>
h1{background-color: orange;}
.hello-enter-active{
    animation: peiliyou 1s linear;
}
.hello-leave-active{
    animation: peiliyou 1s reverse;
}
@keyframes peiliyou {
    from{
        transform: translateX(-100%);
    }
    to{
        transform: translateX(0px);
    }
}
</style>